#ifndef H_BUILDBUDDY_VIEW_H
#define H_BUILDBUDDY_VIEW_H

#include <stddef.h>

/**
 * Types
 **/
enum bb_output_type
{
    BB_OUTPUT_UNKNOWN,
    BB_OUTPUT_BUILD_ERROR,
    BB_OUTPUT_BUILD_WARNING,
    BB_OUTPUT_BUILD_OTHER,
    BB_OUTPUT_CONTROL
};

struct bb_output_props
{
    enum bb_output_type type;
    char const* error_substr;
    char const* warning_substr;
};

typedef void (*bb_view_output_listener)(void*, struct bb_output_props const*, char const*);

struct bb_view
{
    bb_view_output_listener listener;
    void *listener_arg0;
};

/**
 * Init/Unit
 **/
void bb_view_init(struct bb_view*, bb_view_output_listener, void*);
void bb_view_uninit(struct bb_view*);

/**
 * Events
 **/
void bb_view_on_build_output(struct bb_view*, char const*);
void bb_view_on_control_output(struct bb_view*, char const*);

/**
 * Simple output listener that prints directly to stdout
 **/
void bb_view_stdout_output_listener(void*, struct bb_output_props const*, char const*);

#endif

